package com.joysuch.wwyt.risk.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@Data
@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_risk_district_business_evaluation")
@SQLDelete(sql = "update wwyt_risk_district_business_evaluation set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_risk_district_business_evaluation set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class RiskEvaluationBusiness implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("风险评估id")
    private Long id;

    @ApiModelProperty("风险区域id")
    private Long riskDistrictId;

    @ApiModelProperty("区域风险等级")
    private Integer riskLevel;

    @ApiModelProperty("责任单位id")
    private Long responsibleDepartId;

    @ApiModelProperty("负责人id")
    private Long responsibleUserId;

    @ApiModelProperty("区域固有风险评估id")
    private Long stableId;

    @ApiModelProperty("风险区域固有风险评价等级")
    private Integer stableRiskLevel;

    @ApiModelProperty("评估人id集合")
    private String evaluationUserIds;

    @ApiModelProperty("评估单位id")
    private Long evaluationDepartId;

    @ApiModelProperty("评估日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date evaluationDate;

    @ApiModelProperty("等级校正id集合")
    private String ruleIdJson;

    //通用字段
    @ApiModelProperty("创建人")
    @org.springframework.data.annotation.CreatedBy
    private Long createBy;

    @ApiModelProperty("创建时间")
    @org.springframework.data.annotation.CreatedDate
    private java.time.LocalDateTime createTime;

    @ApiModelProperty("更新人")
    @org.springframework.data.annotation.LastModifiedBy
    private Long updateBy;

    @ApiModelProperty("更新时间")
    @org.springframework.data.annotation.LastModifiedDate
    private java.time.LocalDateTime updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;
}
